    <include file="public@header"/>
	<title>课堂资料</title>
<style>
.list-boxes {
    overflow: hidden;
    padding: 15px 20px;
    margin-bottom:25px;
    background: #fff;
    -webkit-transition: all 0.3s ease-in-out;
    -moz-transition: all 0.3s ease-in-out;
    -o-transition: all 0.3s ease-in-out;
    transition: all 0.3s ease-in-out;
    word-wrap: break-word;
    word-break: break-all;
    border: solid 1px #eee;
}
</style>
<style>
.breadcrumb {
  padding: 8px 15px;
  margin-bottom: 20px;
  list-style: none;
  background-color: #f5f5f5;
  border-radius: 4px;
  font-size: 20px;
}
.breadcrumb > li + li:before {
    color: #CCCCCC;
    content: "-> ";
    padding: 0 5px;
	font-size: 30px;
}
</style>
<style>
.badge-warning{
	font-size:14px;
	background-color:#95a5a6;
	padding:7px 12px;
	margin:3px;
	cursor:pointer;
}
.badge-selected{
	background-color:#fa3;
}
</style>
</head>
<body class="body-white wrap js-check-wrap">
	<ol class="breadcrumb">
		<li><a href="javascript:history.back(-1)">{$this_timetable_data['class_name']}</a></li>
		<li class="active">课堂资料</li>
	</ol>
<div class="container">
    <h2>{$this_timetable_data['class_name']}-课堂资料</h2>
	<div class="btn-group" style="margin-bottom:15px;">
		<button class="btn btn-default">{$this_timetable_data['times']?'第'.$this_timetable_data['times'].'次课':'全部'}</button> <button data-toggle="dropdown" class="btn btn-default dropdown-toggle" style="height:34px;margin-right:5px;"><span class="caret"></span></button>
		<ul class="dropdown-menu">
			<li><a href="{:url('admin/class/class_blog_list',['class_id'=>$this_timetable_data['class_id']])}">全部</a></li>
			<foreach name="class_timetable_list" item="times_vo">
				<li><a href="{:url('admin/class/class_blog_list',['timetable_id'=>$times_vo['id']])}">第{$times_vo['times']}次课</a></li>
			</foreach>
		</ul>
		<foreach name="tags_data" item="tags_data_vo">
			<php>$url_param = $param;unset($url_param['tags']);</php>
			<a href="{:url('admin/class/class_blog_list',$url_param,'',true)}{:isset($param['tags'])&&$param['tags']==$tags_data_vo['id']?'':'/tags/'.$tags_data_vo['id']}"><span onclick='javascript:;' class="badge badge-warning {:isset($param['tags'])&&$param['tags']==$tags_data_vo['id']?'badge-selected':''}">{$tags_data_vo['name']}</span></a>
		</foreach>
		<a class="btn btn-primary pull-right" href="{:url('admin/class/class_blog_add',['timetable_id'=>$this_timetable_data['id']])}">添加课后资料</a>
		</div>
    <div class="row">
        <div class="col-md-12">
			<foreach name="blog_data" item="vo">
				<div class="list-boxes">
					<h3>{$vo['title']} {$vo['is_top']==1?'<span style="color:red;">[置顶]</span>':''} {$vo['delete_time']<time()?'<span style="color:gray;">[过期]</span>':''}</h3>
					<p>{$vo['user_nickname']}最后编辑于{:date("Y-m-d H:i:s",$vo['update_time'])}</p>
					<div id="article_content" style="margin-top:20px;">
						{$vo['content']|default=''}
					</div>
					<ul class="pic-list list-unstyled form-inline">
						<if condition="isset($vo['more']['photos'])">
						<foreach name="$vo['more']['photos']" item="photo_vo" key="photo_key">
							<li>
								<a href="/upload/{$photo_vo['url']}" style="font-size:16px;">
									<li class="fa fa-paperclip normal" style="font-size:16px;"></li>
									<span>{$photo_vo['name']}</span>
								</a>
								<img src="/upload/{$photo_vo['url']}" style="height:36px;margin-left:10px;" onclick="imagePreviewDialog(this.src);">
							</li>
						</foreach>
						</if>
					</ul>
					<ul class="pic-list list-unstyled form-inline">
						<if condition="isset($vo['more']['files'])">
						<foreach name="$vo['more']['files']" item="file_vo" key="file_key">
							 <li>
								<a href="/upload/{$file_vo['url']}" style="font-size:16px;">
									<li class="fa fa-paperclip normal" style="font-size:16px;"></li>
									<span>{$file_vo['name']}</span>
								</a>							
							</li>
						</foreach>
						</if>
					</ul>
					<div>
						<div class="pull-left">
							<div class="list-actions">
								<a href="javascript:;"><i class="fa fa-eye"></i><span>{$vo['post_hits']+1}</span></a>
								<!-- <a href="{:url('portal/Article/doLike')}" class="js-count-btn"><i class="fa fa-thumbs-up"></i><span class="count">12</span></a> -->
								<!-- <a href="{:url('user/Favorite/add')}" class="js-favorite-btn"><i class="fa fa-star-o">13</i></a> -->								
							</div>
						</div>
						<a href="{:url('admin/class/class_blog_edit',['id'=>$vo['id']])}" class="btn btn-warning pull-right">修改</a>
					</div>
				</div>
			</foreach>
			<p style="text-align:center;">没有更多资料了！</p>
        </div>
    </div>

</div>

</body>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script>
$(function(){
	var page = 2;
	var lock = true;
    $(window).scroll( function() {
		var window_height = $(window).height();
		var document_height = $(document).height();
		var scroll_top = $(window).scrollTop();
		
		var need_data = document_height-window_height-scroll_top;

		if(need_data<200&&lock){
			lock = false;
			var url = "{:url('admin/class/class_blog_list',$param,'',true)}";
			$.ajax({
				url: url+'/page/'+page,
				type: 'post',
				success: function (e) {
					if(e['data'].length>0){
						page++;
						lock = true;
						var html_context= '';
						for(var i = 0;i<e['data'].length;i++){
							html_context += "<div class='list-boxes'><h3>"+e['data'][i]['title'];
							
							if((e['data'][i]['is_top']==1)){
								html_context += "<span style='color:red;'>[置顶]</span>";
							}
							if(e['data'][i]['delete_time']*1000<new Date().getTime()){
								html_context += "<span style='color:gray;'>[过期]</span>";
							}
							
							html_context +="</h3><p>"+e['data'][i]['user_nickname']+"最后编辑于"+e['data'][i]['update_time']+"</p><div id='article_content' style='margin-top:20px;'>"+e['data'][i]['content']+"</div><div>";
							if(e['data'][i]['more']!=undefined&&e['data'][i]['more']!=null){
								if(e['data'][i]['more']['photos']!=undefined&&e['data'][i]['more']['photos'].length>0){
									html_context += '<ul class="pic-list list-unstyled form-inline">';
									for(var photos_key = 0;photos_key<e['data'][i]['more']['photos'].length;photos_key++){
										html_context += '<li><a href="/upload/'+e['data'][i]['more']['photos'][photos_key]['url']+'" style="font-size:16px;"><li class="fa fa-paperclip normal" style="font-size:16px;"></li><span>'+e['data'][i]['more']['photos'][photos_key]['name']+'</span></a><img src="/upload/'+e['data'][i]['more']['photos'][photos_key]['url']+'" style="height:36px;margin-left:10px;" onclick="imagePreviewDialog(this.src);"></li>';
									}
									html_context += '</ul>';
								}
								if(e['data'][i]['more']['files']!=undefined&&e['data'][i]['more']['files'].length>0){
									html_context += '<ul class="pic-list list-unstyled form-inline">';
									for(var photos_key = 0;photos_key<e['data'][i]['more']['files'].length;photos_key++){
										html_context += '<li><a href="/upload/'+e['data'][i]['more']['files'][photos_key]['url']+'" style="font-size:16px;"><li class="fa fa-paperclip normal" style="font-size:16px;"></li><span>'+e['data'][i]['more']['files'][photos_key]['name']+'</span></a></li>';
									}
									html_context += '</ul>';
								}
							}
							html_context += "<div class='pull-left'><div class='list-actions'><a href='javascript:;'><i class='fa fa-eye'></i><span>"+e['data'][i]['post_hits']+"</span></a></div></div><a href='{:url('admin/class/class_blog_edit','','',true)}/id/"+e['data'][i]['id']+"' class='btn btn-warning pull-right'>修改</a></div></div>";
						}
						$(".list-boxes:last").after(html_context);
					}
				}
			});
		}
	});
});
</script>
</html>